using System;
using System.Collections.Generic;
using System.Linq;
using Granite.ComponentModel;
using Granite.Testing;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Granite.Commons.Tests
{
    public class ItemRemovedEventAssert<T> : EventAssert<ItemEventArgs<T>>
    {
        readonly INotifyCollectionChanged<T> m_Source;

        public ItemRemovedEventAssert(INotifyCollectionChanged<T> source)
            : base(source)
        {
            m_Source = source;
            m_Source.ItemRemoved += SourceEventFired;
        }

        public EventPair<ItemEventArgs<T>> Expect(T expectedItem)
        {
			var nextEvent = Expect();
            Assert.AreSame(expectedItem, nextEvent.EventArgs.Item, "The Item property was not set correctly.");
            return nextEvent;
        }
    }
}
